﻿<%@ Page Title="Cadastrar vendas" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="CadastrarVendas.aspx.cs" Inherits="TCC_Hotel.Apresentacao.Vendas.CadastrarVendas" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 280px;
        }
    </style>
    <script src="../../Scripts/Mascaras.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-1.7.2.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <asp:Label ID="lblAviso2" runat="server" Text="- O campo com * é obrigatório" ForeColor="Red"></asp:Label>
    </div>
    <p class="title-telas">
        Cadastrar vendas
    </p>
    <div style="margin-bottom: 0px">
        <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="0">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:UpdateProgress ID="updateProgress" runat="server">
                    <ProgressTemplate>
                        <div style="position: fixed; text-align: center; height: 100%; width: 100%; top: 0;
                            right: 0; left: 0; z-index: 9999999; background-color: #000000; opacity: 0.7;">
                            <asp:Image ID="imgUpdateProgress" runat="server" ImageUrl="~/Imagens/loading.gif"
                                AlternateText="Loading ..." ToolTip="Loading ..." Style="padding: 10px; position: fixed;
                                top: 45%; left: 50%;" />
                        </div>
                    </ProgressTemplate>
                </asp:UpdateProgress>
                <asp:Label ID="lblErro" runat="server" Visible="False" ForeColor="Red"></asp:Label>
                <asp:Label ID="lblConfirma" runat="server" Visible="False" ForeColor="Blue"></asp:Label>
                <fieldset>
                    <legend id="legend3" runat="server">
                        <asp:Label ID="Label3" runat="server" Text="Informações da venda"></asp:Label>
                    </legend>
                    <table style="width: 100%;">
                        <tr>
                            <td class="style1">
                                <asp:Label ID="lblApartamento" runat="server" Text="Apartamento:"></asp:Label><br />
                                <asp:DropDownList ID="ddlApartamentos" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlApartamentos_SelectedIndexChanged">
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="style1">
                                <asp:Label ID="lblNomeProduto" runat="server" Text="Produto:"></asp:Label><br />
                                <asp:DropDownList ID="ddlProdutos" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlProdutos_SelectedIndexChanged">
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td class="style1">
                                <asp:Label ID="lblQuantidade" runat="server" Text="Quantidade (Unidades):"></asp:Label>
                                <asp:Label ID="lblValidacaoQuantidade" runat="server" Text="*" ForeColor="Red"></asp:Label><br />
                                <asp:TextBox CssClass="PrecoQuantidade" onkeyup="formataInteiro(this,event);" ID="txtQuantidade"
                                    runat="server" Width="70px" MaxLength="2" AutoPostBack="True" OnTextChanged="txtQuantidade_TextChanged"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="style1">
                                <asp:Label ID="lblPreco" runat="server" Text="Preço(R$):"></asp:Label><br />
                                <asp:TextBox CssClass="PrecoQuantidade" ID="txtPreco" runat="server" Width="70px"
                                    Enabled="false"></asp:TextBox>
                            </td>
                            <td>
                                <asp:Label ID="lblPagamento" runat="server" Text="Pagamento já efetuado:"></asp:Label><br />
                                <asp:CheckBox ID="cknPagamento" runat="server" />
                            </td>
                        </tr>
                    </table>
                </fieldset>
                <div align="left" style="width: 40%; float: left">
                    <asp:Button ID="btnCadastrar" runat="server" Text="Cadastrar venda" Width="120px"
                        OnClick="btnCadastrar_Click" />
                </div>
                <br />
                <br />
                <asp:Label ID="lblMensagemApartamento" runat="server" Text="Vendas do apartamento número "
                    Font-Bold="true"></asp:Label>
                <asp:Label ID="lblNumeroApartamento" runat="server" Font-Bold="true"></asp:Label>:<br />
                <asp:Label ID="lblAvisoNaoVendas" runat="server" Visible="false" Text="Ainda não houve vendas para o apartamento selecionado."></asp:Label>
                <asp:GridView ID="grdVendas" runat="server" AutoGenerateColumns="False" CellPadding="4"
                    Width="100%" AllowPaging="True" BackColor="White" BorderColor="#3366CC" BorderStyle="None"
                    BorderWidth="1px" OnPageIndexChanging="grdVendas_PageIndexChanging" OnRowCommand="grdVendas_RowCommand"
                    OnRowDataBound="grdVendas_RowDataBound" PageSize="3">
                    <Columns>
                        <asp:BoundField DataField="Descricao" HeaderText="Venda">
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Preco" HeaderText="Preço" DataFormatString="{0:c}">
                            <ItemStyle HorizontalAlign="Center" />
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:BoundField>
                        <asp:BoundField HeaderText="Data e hora" DataField="Data">
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:BoundField>
                        <asp:CheckBoxField DataField="Pagamento" HeaderText="Pagamento realizado">
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:CheckBoxField>
                        <asp:ButtonField CommandName="cancelarVenda" HeaderText="Cancelar" Text="Cancelar">
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:ButtonField>
                    </Columns>
                    <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                    <HeaderStyle BackColor="#4B6C9E" Font-Bold="True" ForeColor="white" BorderColor="#4B6C9E"
                        BorderStyle="Double" BorderWidth="1px" />
                    <PagerSettings LastPageText="&gt;&gt;" Mode="NextPreviousFirstLast" NextPageText="Próximo"
                        Position="TopAndBottom" PreviousPageText="Anterior" />
                    <PagerStyle BackColor="White" ForeColor="#003399" HorizontalAlign="Center" BorderColor="#4B6C9E"
                        BorderStyle="None" />
                    <RowStyle BackColor="White" ForeColor="#003399" />
                    <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                    <SortedAscendingCellStyle BackColor="#EDF6F6" />
                    <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
                    <SortedDescendingCellStyle BackColor="#D6DFDF" />
                    <SortedDescendingHeaderStyle BackColor="#002876" />
                </asp:GridView>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
